<html>
 <head>
  <meta charset="utf-8"/>
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"/>
  <title>
   高燕: 关联规则：R与SAS的比较  | 数螺 | NAUT IDEA
  </title>
  <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" rel="stylesheet"/>
  <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
  <style type="text/css">
   #xmain img {
                  max-width: 100%;
                  display: block;
                  margin-top: 10px;
                  margin-bottom: 10px;
                }

                #xmain p {
                    line-height:150%;
                    font-size: 16px;
                    margin-top: 20px;
                }

                #xmain h2 {
                    font-size: 24px;
                }

                #xmain h3 {
                    font-size: 20px;
                }

                #xmain h4 {
                    font-size: 18px;
                }


                .header {
	           background-color: #0099ff;
	           color: #ffffff;
	           margin-bottom: 20px;
	        }

	        .header p {
                  margin: 0px;
                  padding: 10px 0;
                  display: inline-block;  
                  vertical-align: middle;
                  font-size: 16px;
               }

               .header a {
                 color: white;
               }

              .header img {
                 height: 25px;
              }
  </style>
  <script src="http://cdn.bootcss.com/jquery/3.0.0/jquery.min.js">
  </script>
  <script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript">
   MathJax.Hub.Config({
          tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]},
          TeX: {equationNumbers: {autoNumber: "AMS"}}
        });
  </script>
  <script src="http://nautstatic-10007657.file.myqcloud.com/static/css/readability.min.js" type="text/javascript">
  </script>
  <script type="text/javascript">
   $(document).ready(function() {
                 var loc = document.location;
                 var uri = {
                  spec: "http://cos.name/2013/02/association-rules-with-r-and-sas/",
                  host: "http://cos.name",
                  prePath: "http://cos.name",
                  scheme: "http",
                  pathBase: "http://cos.name/"
                 };
    
                 var documentClone = document.cloneNode(true);
                 var article = new Readability(uri, documentClone).parse();
     
                 document.getElementById("xmain").innerHTML = article.content;
                });
  </script>
  <!-- 1466442088: Accept with keywords: (title(0.5):门户网站,规则,关联,统计学,服务平台,中国, topn(0.333333333333):泰坦尼克号,软件应用,规则,头等舱,统计学,R语言,泰坦尼克,数据挖掘,儿童,结果,模型,中文论坛,可视化,二等舱,文章,时间序列,数据,同学,对象,关联,算法,资料,会议,错误,购物篮,代码,评论,论坛,软件,初学者).-->
 </head>
 <body class="single single-post postid-7227 single-format-standard sidebar" onload="">
  <div class="header">
   <div class="container">
    <div class="row">
     <div class="col-xs-6 col-sm-6 text-left">
      <a href="/databee">
       <img src="http://nautidea-10007657.cos.myqcloud.com/logo_white.png"/>
      </a>
      <a href="/databee">
       <p>
        数螺
       </p>
      </a>
     </div>
     <div class="hidden-xs col-sm-6 text-right">
      <p>
       致力于数据科学的推广和知识传播
      </p>
     </div>
    </div>
   </div>
  </div>
  <div class="container text-center">
   <h1>
    高燕: 关联规则：R与SAS的比较
   </h1>
  </div>
  <div class="container" id="xmain">
   <div class="hfeed site" id="page">
    <header class="site-header" id="masthead" role="banner">
     <div id="cos-logo">
      <a href="http://cos.name/">
       <img src="http://cos.name/wp-content/themes/COS-kermesinus/images/headers/cos-logo.png"/>
      </a>
     </div>
     <div class="navbar" id="navbar">
      <nav class="navigation main-navigation" id="site-navigation" role="navigation">
       <h3 class="menu-toggle">
        菜单
       </h3>
       <a class="screen-reader-text skip-link" href="http://cos.name/2013/02/association-rules-with-r-and-sas/#content" title="跳至内容">
        跳至内容
       </a>
       <div class="menu-%e6%88%91%e7%9a%84%e8%8f%9c%e5%8d%95-container">
        <ul class="nav-menu" id="menu-%e6%88%91%e7%9a%84%e8%8f%9c%e5%8d%95">
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-home menu-item-4746" id="menu-item-4746">
          <a href="http://cos.name">
           主页
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children menu-item-8120" id="menu-item-8120">
          <a href="http://cos.name/cn">
           论坛
          </a>
          <ul class="sub-menu">
           <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-8124" id="menu-item-8124">
            <a href="http://cos.name/cn/wp-login.php?action=register">
             论坛注册
            </a>
           </li>
           <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-8125" id="menu-item-8125">
            <a href="http://cos.name/cn/wp-login.php">
             论坛登录
            </a>
           </li>
          </ul>
         </li>
         <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-8110" id="menu-item-8110">
          <a href="http://cos.name/books/">
           图书资料
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-8112" id="menu-item-8112">
          <a href="http://cos.name/videos">
           视频教程
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-8333" id="menu-item-8333">
          <a href="http://cos.name/salon/">
           统计沙龙
          </a>
         </li>
         <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-8111" id="menu-item-8111">
          <a href="http://cos.name/chinar/">
           R语言会议
          </a>
         </li>
         <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-8109" id="menu-item-8109">
          <a href="http://cos.name/training/">
           讲座与培训
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-8115" id="menu-item-8115">
          <a href="http://cos.name/cn/forum/comprehensive/job/">
           招聘信息
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children menu-item-4780" id="menu-item-4780">
          <a href="http://cos.name/about">
           关于我们
          </a>
          <ul class="sub-menu">
           <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-8113" id="menu-item-8113">
            <a href="http://cos.name/2008/11/how-to-work-with-cos/">
             加入我们
            </a>
           </li>
           <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-8119" id="menu-item-8119">
            <a href="http://cos.name/donate/">
             赞助我们
            </a>
           </li>
           <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-8114" id="menu-item-8114">
            <a href="http://cos.name/cn/forum/26">
             项目合作
            </a>
           </li>
          </ul>
         </li>
        </ul>
       </div>
       <form action="http://cos.name/" class="search-form" method="get" role="search">
        <label>
         <span class="screen-reader-text">
          搜索：
         </span>
        </label>
       </form>
      </nav>
      <!-- #site-navigation -->
     </div>
     <!-- #navbar -->
    </header>
    <!-- #masthead -->
    <div class="site-main" id="main">
     <div class="content-area" id="primary">
      <div class="site-content" id="content" role="main">
       <article class="post-7227 post type-post status-publish format-standard hentry category-packages category-software tag-r-language tag-sas tag-646" id="post-7227">
        <header class="entry-header">
         <h1 class="entry-title">
          关联规则：R与SAS的比较
         </h1>
         <div class="entry-meta">
          <span class="date">
           <a href="http://cos.name/2013/02/association-rules-with-r-and-sas/" rel="bookmark" title="链向关联规则：R与SAS的比较的固定链接">
            <time class="entry-date" datetime="2013-02-17T20:10:19+00:00">
             2013/02/17
            </time>
           </a>
          </span>
          <span class="categories-links">
           <a href="http://cos.name/category/software/packages/" rel="category tag">
            统计软件
           </a>
           、
           <a href="http://cos.name/category/software/" rel="category tag">
            软件应用
           </a>
          </span>
          <span class="tags-links">
           <a href="http://cos.name/tag/r-language/" rel="tag">
            R语言
           </a>
           、
           <a href="http://cos.name/tag/sas/" rel="tag">
            SAS
           </a>
           、
           <a href="http://cos.name/tag/%e5%85%b3%e8%81%94%e5%88%86%e6%9e%90/" rel="tag">
            关联分析
           </a>
          </span>
          <span class="author vcard">
           <a class="url fn n" href="http://cos.name/author/emilygao/" rel="author" title="查看所有由高 燕发布的文章">
            高 燕
           </a>
          </span>
         </div>
         <!-- .entry-meta -->
        </header>
        <!-- .entry-header -->
        <div class="entry-content">
         <p>
          啤酒和尿布的故事是关联分析方法最经典的案例，而用于关联分析的Apriori算法更是十大数据挖掘算法之一（
          <a href="http://www.cs.uvm.edu/~icdm/algorithms/index.shtml">
           http://www.cs.uvm.edu/~icdm/algorithms/index.shtml
          </a>
          ，这个排名虽然是几年前的调查结果，但是其重要性仍可见一斑）。本文以《
          <a href="http://www.rdatamining.com/docs" target="_blank">
           R and Data Mining
          </a>
          》书中使用的泰坦尼克号人员的生存数据为例，介绍如何使用R和SAS的Apriori算法进行关联分析，比较两者的建模结果并对结果中存在的差异进行解释分析。
         </p>
         <p>
          <strong>
           一、关联分析
          </strong>
         </p>
         <p>
          网上有很多资料介绍关联分析算法，本文就不再赘述。我自己看的是《Introduction to Data Mining》(有对应的中文版，人民邮电出版社的《
          <a href="http://book.douban.com/subject/1786120/" target="_blank">
           数据挖掘导论
          </a>
          》)，愿意看英文的同学可以访问：
          <a href="http://www-users.cs.umn.edu/~kumar/dmbook/ch6.pdf">
           http://www-users.cs.umn.edu/~kumar/dmbook/ch6.
          </a>
          <a href="http://www-users.cs.umn.edu/~kumar/dmbook/ch6.pdf">
           pdf
          </a>
          。网上其他的资料我也大致翻过，对比之后感觉这本书是一本相当不错的教材，算法方面介绍地比较全面且有一定深度。我本人不建议大家去看那些非专业人士总结的关联分析算法介绍，虽然浅显易懂，但是内容片面，容易误导初学者，错把树木当成了森林。
         </p>
         <p>
          对于关联分析在行业应用中的经验分享、初学者的误区和最佳实践方面的资料很少，唯一能找到的一本好书是清华大学出版社的《
          <a href="http://book.douban.com/subject/3283973/" target="_blank">
           啤酒与尿布
          </a>
          》，主要介绍购物篮分析在零售行业的应用。我始终认为分析师除了算法和软件，还需要了解行业背景，不然挖出的只是模式，而不是切实可行并且能带来商业价值的模式，甚至还有可能是错误的模式。
          <span id="more-7227">
          </span>
         </p>
         <p>
          <strong>
           二、软件
          </strong>
         </p>
         <p>
          我只用过R和SAS，其他的软件没碰过，所以只能对这两个软件进行比较。
         </p>
         <table cellpadding="5" cellspacing="1">
          <tbody>
           <tr>
            <td>
             <strong>
              算法
             </strong>
            </td>
            <td>
             <strong>
              R/ARULES
             </strong>
            </td>
            <td>
             <strong>
              SAS/EM
             </strong>
            </td>
           </tr>
           <tr>
            <td>
             Apriori
            </td>
            <td>
             Yes
            </td>
            <td>
             Yes
            </td>
           </tr>
           <tr>
            <td>
             ECLAT
            </td>
            <td>
             Yes
            </td>
            <td>
             No
            </td>
           </tr>
           <tr>
            <td>
             FP-Growth
            </td>
            <td>
             No
            </td>
            <td>
             No
            </td>
           </tr>
          </tbody>
         </table>
         <p>
          据网友说Excel也能做关联分析，但是因为其对数据进行了抽样，所以每次运行的结果都不一样。SPSS的Modeler不知道怎么样，有用过的同学请分享一下经验，最好使用泰坦尼克号的数据进行分析，这样可以比较一下各软件的结果是否相同。
         </p>
         <p>
          <strong>
           三、R的代码和结果
          </strong>
         </p>
         <p>
          R的代码主要来自《
          <a href="http://www.rdatamining.com/docs" target="_blank">
           R and Data Mining
          </a>
          》，我只加了下载数据的代码和对代码的中文说明。
         </p>
         <p>
          1）下载泰坦尼克数据
         </p>
         <p>
          setInternet2(TRUE)
          <br/>
          con &lt;- url(“
          <a href="http://www.rdatamining.com/data/titanic.raw.rdata">
           http://www.rdatamining.com/data/titanic.raw.rdata
          </a>
          “)
          <br/>
          load(con)
          <br/>
          close(con) # url() always opens the connection
          <br/>
          str(titanic.raw)
         </p>
         <p>
          2）关联分析
         </p>
         <p>
          library(arules)
          <br/>
          # find association rules with default settings
          <br/>
          rules &lt;- apriori(titanic.raw)
          <br/>
          inspect(rules)
         </p>
         <p>
          3）只保留结果中包含生存变量的关联规则
         </p>
         <p>
          # rules with rhs containing “Survived” only
          <br/>
          rules &lt;- apriori(titanic.raw, parameter = list(minlen=2, supp=0.005, conf=0.8), appearance = list(rhs=c(“Survived=No”, “Survived=Yes”), default=”lhs”),control = list(verbose=F))
          <br/>
          rules.sorted &lt;- sort(rules, by=”lift”)
          <br/>
          inspect(rules.sorted)
         </p>
         <p>
          R 总共生成了12条跟人员生存相关的规则：
          <br/>
          lhs       rhs      support      confidence      lift
          <br/>
          1 {Class=2nd, Age=Child}                         =&gt; {Survived=Yes}
          <br/>
          0.010904134 1.0000000 3.095640
          <br/>
          2 {Class=2nd, Sex=Female, Age=Child}  =&gt; {Survived=Yes}
          <br/>
          0.005906406 1.0000000 3.095640
          <br/>
          3 {Class=1st, Sex=Female}                      =&gt; {Survived=Yes}
          <br/>
          0.064061790 0.9724138 3.010243
          <br/>
          4 {Class=1st, Sex=Female, Age=Adult}    =&gt; {Survived=Yes}
          <br/>
          0.063607451 0.9722222 3.009650
          <br/>
          5 {Class=2nd, Sex=Male, Age=Adult}        =&gt; {Survived=No}
          <br/>
          0.069968196 0.9166667 1.354083
          <br/>
          6 {Class=2nd, Sex=Female}                      =&gt; {Survived=Yes}
          <br/>
          0.042253521 0.8773585 2.715986
          <br/>
          7 {Class=Crew, Sex=Female}                   =&gt; {Survived=Yes}
          <br/>
          0.009086779 0.8695652 2.691861
          <br/>
          8 {Class=Crew, Sex=Female, Age=Adult} =&gt; {Survived=Yes}
          <br/>
          0.009086779 0.8695652 2.691861
          <br/>
          9 {Class=2nd, Sex=Male}                           =&gt; {Survived=No}
          <br/>
          0.069968196 0.8603352 1.270871
          <br/>
          10 {Class=2nd, Sex=Female, Age=Adult}  =&gt; {Survived=Yes}
          <br/>
          0.036347115 0.8602151 2.662916
          <br/>
          11 {Class=3rd, Sex=Male, Age=Adult}       =&gt; {Survived=No}
          <br/>
          0.175829169 0.8376623 1.237379
          <br/>
          12 {Class=3rd, Sex=Male}                          =&gt; {Survived=No}
          <br/>
          0.191731031 0.8274510 1.222295
         </p>
         <p>
          4）去除冗余的规则
         </p>
         <p>
          # find redundant rules
          <br/>
          subset.matrix &lt;- is.subset(rules.sorted, rules.sorted)
          <br/>
          subset.matrix[lower.tri(subset.matrix, diag=T)] &lt;- NA
          <br/>
          redundant &lt;- colSums(subset.matrix, na.rm=T) &gt;= 1
          <br/>
          which(redundant)
         </p>
         <p>
          # remove redundant rules
          <br/>
          rules.pruned &lt;- rules.sorted[!redundant]
          <br/>
          inspect(rules.pruned)
         </p>
         <p>
          去除冗余的规则后剩下8条规则：
          <br/>
          lhs       rhs      support      confidence      lift
          <br/>
          1 {Class=2nd, Age=Child}                   =&gt; {Survived=Yes}
          <br/>
          0.010904134  1.0000000 3.095640
          <br/>
          <span style="color: #ff0e40">
           2 {Class=1st, Sex=Female}                =&gt; {Survived=Yes}
           <br/>
           0.064061790  0.9724138 3.010243
           <br/>
           3 {Class=2nd, Sex=Female}               =&gt; {Survived=Yes}
           <br/>
          </span>
          <span style="color: #ff0e40">
           0.042253521  0.8773585 2.715986
           <br/>
          </span>
          4 {Class=Crew, Sex=Female}            =&gt; {Survived=Yes}
          <br/>
          0.009086779  0.8695652 2.691861
          <br/>
          5 {Class=2nd, Sex=Male, Age=Adult} =&gt; {Survived=No}
          <br/>
          0.069968196  0.9166667 1.354083
          <br/>
          6 {Class=2nd, Sex=Male}                   =&gt; {Survived=No}
          <br/>
          0.069968196  0.8603352 1.270871
          <br/>
          7 {Class=3rd, Sex=Male, Age=Adult}  =&gt; {Survived=No}
          <br/>
          0.175829169  0.8376623 1.237379
          <br/>
          8 {Class=3rd, Sex=Male}                    =&gt; {Survived=No}
          <br/>
          0.191731031  0.8274510 1.222295
         </p>
         <p>
          5）结果的解释
         </p>
         <p>
          对于结果的解释，一定要慎重，千万不要盲目下结论。从下面的四条规则看，好像确实像电影中描述的那样：妇女和儿童优先。
         </p>
         <p>
          1 {Class=2nd, Age=Child}              =&gt; {Survived=Yes} 0.010904134  1.0000000 3.095640
          <br/>
          2 {Class=1st, Sex=Female}           =&gt; {Survived=Yes} 0.064061790  0.9724138 3.010243
          <br/>
          3 {Class=2nd, Sex=Female}          =&gt; {Survived=Yes} 0.042253521  0.8773585 2.715986
          <br/>
          4 {Class=Crew, Sex=Female}       =&gt; {Survived=Yes} 0.009086779  0.8695652 2.691861
         </p>
         <p>
          如果我们减小最小支持率和置信度的阈值，则能看到更多的真相。
         </p>
         <p>
          rules &lt;- apriori(titanic.raw, parameter = list(minlen=3, supp=0.002, conf=0.2), appearance = list(rhs=c(“Survived=Yes”), lhs=c(“Class=1st”, “Class=2nd”, “Class=3rd”, “Age=Child”, “Age=Adult”), default=”none”), control = list(verbose=F))
          <br/>
          rules.sorted &lt;- sort(rules, by=”confidence”)
          <br/>
          inspect(rules.sorted)
         </p>
         <p>
          lhs                        rhs           support     confidence lift
          <br/>
          1 {Class=2nd, Age=Child} =&gt; {Survived=Yes} 0.010904134 1.0000000 3.0956399
          <br/>
          2 {Class=1st, Age=Child} =&gt; {Survived=Yes} 0.002726034 1.0000000 3.0956399
          <br/>
          <span style="color: #ff0b5d">
           3 {Class=1st, Age=Adult} =&gt; {Survived=Yes} 0.089504771 0.6175549 1.9117275
           <br/>
          </span>
          4 {Class=2nd, Age=Adult} =&gt; {Survived=Yes} 0.042707860 0.3601533 1.1149048
          <br/>
          <span style="color: #fe1967">
           5 {Class=3rd, Age=Child} =&gt; {Survived=Yes} 0.012267151 0.3417722 1.0580035
           <br/>
          </span>
          6 {Class=3rd, Age=Adult} =&gt; {Survived=Yes} 0.068605179 0.2408293 0.7455209
         </p>
         <p>
          从规则3和规则5以及之前的规则2和3可以看出泰坦尼克号获得优先权的主要是头等舱、二等舱的妇孺。
         </p>
         <p>
          据统计，头等舱男乘客的生还率比三等舱中儿童的生还率还稍高一点。美国新泽西州州立大学教授、著名社会学家戴维·波普诺研究后毫不客气地修改了曾使英国人颇感“安慰”的“社会规范”(妇女和儿童优先)：“在泰坦尼克号上实践的社会规范这样表述可能更准确一些：‘头等舱和二等舱的妇女和儿童优先’。”
         </p>
         <p>
          这些是关于泰坦尼克号生存数据分析的资料：
          <br/>
          <a href="http://news.163.com/12/0413/03/7UUM5NJV00014AED.html">
           泰坦尼克号逃生真相：“妇女儿童优先”只是个传说
          </a>
          <br/>
          <a href="http://www.360doc.com/content/09/0403/11/9807_3007700">
           历史没有那么温暖
          </a>
         </p>
         <p>
          6）可视化
         </p>
         <p>
          # visualize rules
          <br/>
          library(arulesViz)
          <br/>
          plot(rules)
          <br/>
          plot(rules, method=”graph”, control=list(type=”items”))
          <br/>
          plot(rules, method=”paracoord”, control=list(reorder=TRUE))
         </p>
         <p>
          对于不熟悉R的SAS用户，可以阅读以下资料学习R以及ARULES包：
          <br/>
          <a href="http://cran.r-project.org/web/packages/arules/vignettes/arules.pdf">
           http://cran.r-project.org/web/packages/arules/vignettes/arules.pdf
          </a>
          <br/>
          <a href="https://science.nature.nps.gov/im/datamgmt/statistics/R/documents/R_for_SAS_SPSS_users.pdf">
           https://science.nature.nps.gov/im/datamgmt/statistics/R/documents/R_for_SAS_SPSS_users.pdf
          </a>
         </p>
         <p>
          四、SAS代码和结果
         </p>
         <p>
          1）下载泰坦尼克数据
         </p>
         <p>
          <b>
           <span style="font-family: Courier New;color: #000080;font-size: small">
            <span style="font-family: Courier New;color: #000080;font-size: small">
             <span style="font-family: Courier New;color: #000080;font-size: small">
              proc
             </span>
            </span>
           </span>
          </b>
          <b>
           <span style="font-family: Courier New;color: #000080;font-size: small">
            <span style="font-family: Courier New;color: #000080;font-size: small">
             <span style="font-family: Courier New;color: #000080;font-size: small">
              iml
             </span>
            </span>
           </span>
          </b>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            ;
            <br/>
           </span>
          </span>
          <span style="font-family: Courier New;color: #ff0000;font-size: small">
           <span style="font-family: Courier New;color: #ff0000;font-size: small">
            <span style="font-family: Courier New;color: #ff0000;font-size: small">
             submit
            </span>
           </span>
          </span>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            /R;
            <br/>
           </span>
          </span>
          setInternet2(TRUE)
          <br/>
          con &lt;- url(
          <span style="font-family: Courier New;color: #800080;font-size: small">
           <span style="font-family: Courier New;color: #800080;font-size: small">
            <span style="font-family: Courier New;color: #800080;font-size: small">
             <a href="http://www.rdatamining.com/data/titanic.raw.rdata">
              http://www.rdatamining.com/data/titanic.raw.rdata
             </a>
            </span>
           </span>
          </span>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            )
            <br/>
           </span>
          </span>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            load(con)
            <br/>
           </span>
          </span>
          close(con) # url() always opens the connection
          <br/>
          endsubmit;
         </p>
         <p>
          <span style="font-family: Courier New;color: #0000ff;font-size: small">
           <span style="font-family: Courier New;color: #0000ff;font-size: small">
            <span style="font-family: Courier New;color: #0000ff;font-size: small">
             call
            </span>
           </span>
          </span>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            ImportDataSetFromR(
           </span>
          </span>
          <span style="font-family: Courier New;color: #800080;font-size: small">
           <span style="font-family: Courier New;color: #800080;font-size: small">
            <span style="font-family: Courier New;color: #800080;font-size: small">
             “Work.titanic”
            </span>
           </span>
          </span>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            ,
           </span>
          </span>
          <span style="font-family: Courier New;color: #800080;font-size: small">
           <span style="font-family: Courier New;color: #800080;font-size: small">
            <span style="font-family: Courier New;color: #800080;font-size: small">
             “titanic.raw”
            </span>
           </span>
          </span>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            );
            <br/>
           </span>
          </span>
          <b>
           <span style="font-family: Courier New;color: #000080;font-size: small">
            <span style="font-family: Courier New;color: #000080;font-size: small">
             <span style="font-family: Courier New;color: #000080;font-size: small">
              run
             </span>
            </span>
           </span>
          </b>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            ;
           </span>
          </span>
          <b>
           <span style="font-family: Courier New;color: #000080;font-size: small">
            <span style="font-family: Courier New;color: #000080;font-size: small">
             <span style="font-family: Courier New;color: #000080;font-size: small">
              quit
             </span>
            </span>
           </span>
          </b>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            ;
           </span>
          </span>
         </p>
         <p>
          2）将数据转换成SAS/EM要求的格式
         </p>
         <p>
          <b>
           <span style="font-family: Courier New;color: #000080;font-size: small">
            <span style="font-family: Courier New;color: #000080;font-size: small">
             <span style="font-family: Courier New;color: #000080;font-size: small">
              data
             </span>
            </span>
           </span>
          </b>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            items2;
            <br/>
           </span>
          </span>
          <span style="font-family: Courier New;color: #0000ff;font-size: small">
           <span style="font-family: Courier New;color: #0000ff;font-size: small">
            <span style="font-family: Courier New;color: #0000ff;font-size: small">
             set
            </span>
           </span>
          </span>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            titanic;
            <br/>
           </span>
          </span>
          <span style="font-family: Courier New;color: #0000ff;font-size: small">
           <span style="font-family: Courier New;color: #0000ff;font-size: small">
            <span style="font-family: Courier New;color: #0000ff;font-size: small">
             length
            </span>
           </span>
          </span>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            tid
           </span>
          </span>
          <b>
           <span style="font-family: Courier New;color: #008080;font-size: small">
            <span style="font-family: Courier New;color: #008080;font-size: small">
             <span style="font-family: Courier New;color: #008080;font-size: small">
              8
             </span>
            </span>
           </span>
          </b>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            ;
            <br/>
           </span>
          </span>
          <span style="font-family: Courier New;color: #0000ff;font-size: small">
           <span style="font-family: Courier New;color: #0000ff;font-size: small">
            <span style="font-family: Courier New;color: #0000ff;font-size: small">
             length
            </span>
           </span>
          </span>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            item $
           </span>
          </span>
          <b>
           <span style="font-family: Courier New;color: #008080;font-size: small">
            <span style="font-family: Courier New;color: #008080;font-size: small">
             <span style="font-family: Courier New;color: #008080;font-size: small">
              8
             </span>
            </span>
           </span>
          </b>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            ;
            <br/>
           </span>
          </span>
          tid = _n_;
          <br/>
          item = class;
          <br/>
          <span style="font-family: Courier New;color: #0000ff;font-size: small">
           <span style="font-family: Courier New;color: #0000ff;font-size: small">
            <span style="font-family: Courier New;color: #0000ff;font-size: small">
             output
            </span>
           </span>
          </span>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            ;
            <br/>
           </span>
          </span>
          item = sex;
          <br/>
          <span style="font-family: Courier New;color: #0000ff;font-size: small">
           <span style="font-family: Courier New;color: #0000ff;font-size: small">
            <span style="font-family: Courier New;color: #0000ff;font-size: small">
             output
            </span>
           </span>
          </span>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            ;
            <br/>
           </span>
          </span>
          item = age;
          <br/>
          <span style="font-family: Courier New;color: #0000ff;font-size: small">
           <span style="font-family: Courier New;color: #0000ff;font-size: small">
            <span style="font-family: Courier New;color: #0000ff;font-size: small">
             output
            </span>
           </span>
          </span>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            ;
            <br/>
           </span>
          </span>
          item = survived;
          <br/>
          <span style="font-family: Courier New;color: #0000ff;font-size: small">
           <span style="font-family: Courier New;color: #0000ff;font-size: small">
            <span style="font-family: Courier New;color: #0000ff;font-size: small">
             output
            </span>
           </span>
          </span>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            ;
            <br/>
           </span>
          </span>
          <span style="font-family: Courier New;color: #0000ff;font-size: small">
           <span style="font-family: Courier New;color: #0000ff;font-size: small">
            <span style="font-family: Courier New;color: #0000ff;font-size: small">
             keep
            </span>
           </span>
          </span>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            tid item;
            <br/>
           </span>
          </span>
          <span style="font-family: Courier New;color: #0000ff;font-size: small">
           <span style="font-family: Courier New;color: #0000ff;font-size: small">
            <span style="font-family: Courier New;color: #0000ff;font-size: small">
             run
            </span>
           </span>
          </span>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            ;
           </span>
          </span>
         </p>
         <p>
          3）关联分析
         </p>
         <p>
          <b>
           <span style="font-family: Courier New;color: #000080;font-size: small">
            <span style="font-family: Courier New;color: #000080;font-size: small">
             <span style="font-family: Courier New;color: #000080;font-size: small">
              proc
             </span>
            </span>
           </span>
          </b>
          <b>
           <span style="font-family: Courier New;color: #000080;font-size: small">
            <span style="font-family: Courier New;color: #000080;font-size: small">
             <span style="font-family: Courier New;color: #000080;font-size: small">
              dmdb
             </span>
            </span>
           </span>
          </b>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            data=items2 dmdbcat=dbcat;
            <br/>
           </span>
          </span>
          <span style="font-family: Courier New;color: #0000ff;font-size: small">
           <span style="font-family: Courier New;color: #0000ff;font-size: small">
            <span style="font-family: Courier New;color: #0000ff;font-size: small">
             class
            </span>
           </span>
          </span>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            tid item;
            <br/>
           </span>
          </span>
          <b>
           <span style="font-family: Courier New;color: #000080;font-size: small">
            <span style="font-family: Courier New;color: #000080;font-size: small">
             <span style="font-family: Courier New;color: #000080;font-size: small">
              run
             </span>
            </span>
           </span>
          </b>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            ;
           </span>
          </span>
          <b>
           <span style="font-family: Courier New;color: #000080;font-size: small">
            <span style="font-family: Courier New;color: #000080;font-size: small">
             <span style="font-family: Courier New;color: #000080;font-size: small">
              quit
             </span>
            </span>
           </span>
          </b>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            ;
           </span>
          </span>
         </p>
         <p>
          <b>
           <span style="font-family: Courier New;color: #000080;font-size: small">
            <span style="font-family: Courier New;color: #000080;font-size: small">
             <span style="font-family: Courier New;color: #000080;font-size: small">
              proc
             </span>
            </span>
           </span>
          </b>
          <b>
           <span style="font-family: Courier New;color: #000080;font-size: small">
            <span style="font-family: Courier New;color: #000080;font-size: small">
             <span style="font-family: Courier New;color: #000080;font-size: small">
              assoc
             </span>
            </span>
           </span>
          </b>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            data=items2 dmdbcat=dbcat pctsup=
           </span>
          </span>
          <b>
           <span style="font-family: Courier New;color: #008080;font-size: small">
            <span style="font-family: Courier New;color: #008080;font-size: small">
             <span style="font-family: Courier New;color: #008080;font-size: small">
              0.5
             </span>
            </span>
           </span>
          </b>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            out=frequentItems;
            <br/>
           </span>
          </span>
          <span style="font-family: Courier New;color: #0000ff;font-size: small">
           <span style="font-family: Courier New;color: #0000ff;font-size: small">
            <span style="font-family: Courier New;color: #0000ff;font-size: small">
             id
            </span>
           </span>
          </span>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            tid;
            <br/>
           </span>
          </span>
          target item;
          <br/>
          <b>
           <span style="font-family: Courier New;color: #000080;font-size: small">
            <span style="font-family: Courier New;color: #000080;font-size: small">
             <span style="font-family: Courier New;color: #000080;font-size: small">
              run
             </span>
            </span>
           </span>
          </b>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            ;
           </span>
          </span>
         </p>
         <p>
          <b>
           <span style="font-family: Courier New;color: #000080;font-size: small">
            <span style="font-family: Courier New;color: #000080;font-size: small">
             <span style="font-family: Courier New;color: #000080;font-size: small">
              proc
             </span>
            </span>
           </span>
          </b>
          <b>
           <span style="font-family: Courier New;color: #000080;font-size: small">
            <span style="font-family: Courier New;color: #000080;font-size: small">
             <span style="font-family: Courier New;color: #000080;font-size: small">
              rulegen
             </span>
            </span>
           </span>
          </b>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            in=frequentItems dmdbcat=dbcat out=rules minconf=
           </span>
          </span>
          <b>
           <span style="font-family: Courier New;color: #008080;font-size: small">
            <span style="font-family: Courier New;color: #008080;font-size: small">
             <span style="font-family: Courier New;color: #008080;font-size: small">
              80
             </span>
            </span>
           </span>
          </b>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            ;
            <br/>
           </span>
          </span>
          <b>
           <span style="font-family: Courier New;color: #000080;font-size: small">
            <span style="font-family: Courier New;color: #000080;font-size: small">
             <span style="font-family: Courier New;color: #000080;font-size: small">
              run
             </span>
            </span>
           </span>
          </b>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            ;
           </span>
          </span>
         </p>
         <p>
          <b>
           <span style="font-family: Courier New;color: #000080;font-size: small">
            <span style="font-family: Courier New;color: #000080;font-size: small">
             <span style="font-family: Courier New;color: #000080;font-size: small">
              proc
             </span>
            </span>
           </span>
          </b>
          <b>
           <span style="font-family: Courier New;color: #000080;font-size: small">
            <span style="font-family: Courier New;color: #000080;font-size: small">
             <span style="font-family: Courier New;color: #000080;font-size: small">
              sort
             </span>
            </span>
           </span>
          </b>
          <span style="font-family: Courier New;color: #0000ff;font-size: small">
           <span style="font-family: Courier New;color: #0000ff;font-size: small">
            <span style="font-family: Courier New;color: #0000ff;font-size: small">
             data
            </span>
           </span>
          </span>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            =rules;
            <br/>
           </span>
          </span>
          <span style="font-family: Courier New;color: #0000ff;font-size: small">
           <span style="font-family: Courier New;color: #0000ff;font-size: small">
            <span style="font-family: Courier New;color: #0000ff;font-size: small">
             by
            </span>
           </span>
          </span>
          <span style="font-family: Courier New;color: #0000ff;font-size: small">
           <span style="font-family: Courier New;color: #0000ff;font-size: small">
            <span style="font-family: Courier New;color: #0000ff;font-size: small">
             descending
            </span>
           </span>
          </span>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            conf;
            <br/>
           </span>
          </span>
          <b>
           <span style="font-family: Courier New;color: #000080;font-size: small">
            <span style="font-family: Courier New;color: #000080;font-size: small">
             <span style="font-family: Courier New;color: #000080;font-size: small">
              run
             </span>
            </span>
           </span>
          </b>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            ;
           </span>
          </span>
         </p>
         <p>
          4） 只保留结果中包含生存变量的关联规则
         </p>
         <p>
          <b>
           <span style="font-family: Courier New;color: #000080;font-size: small">
            <span style="font-family: Courier New;color: #000080;font-size: small">
             <span style="font-family: Courier New;color: #000080;font-size: small">
              data
             </span>
            </span>
           </span>
          </b>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            surviverules;
            <br/>
           </span>
          </span>
          <span style="font-family: Courier New;color: #0000ff;font-size: small">
           <span style="font-family: Courier New;color: #0000ff;font-size: small">
            <span style="font-family: Courier New;color: #0000ff;font-size: small">
             set
            </span>
           </span>
          </span>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            rules(
           </span>
          </span>
          <span style="font-family: Courier New;color: #0000ff;font-size: small">
           <span style="font-family: Courier New;color: #0000ff;font-size: small">
            <span style="font-family: Courier New;color: #0000ff;font-size: small">
             where
            </span>
           </span>
          </span>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            =(set_size&gt;
           </span>
          </span>
          <b>
           <span style="font-family: Courier New;color: #008080;font-size: small">
            <span style="font-family: Courier New;color: #008080;font-size: small">
             <span style="font-family: Courier New;color: #008080;font-size: small">
              1
             </span>
            </span>
           </span>
          </b>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            and (_rhand=
           </span>
          </span>
          <span style="font-family: Courier New;color: #800080;font-size: small">
           <span style="font-family: Courier New;color: #800080;font-size: small">
            <span style="font-family: Courier New;color: #800080;font-size: small">
             ‘Yes’
            </span>
           </span>
          </span>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            or _rhand=
           </span>
          </span>
          <span style="font-family: Courier New;color: #800080;font-size: small">
           <span style="font-family: Courier New;color: #800080;font-size: small">
            <span style="font-family: Courier New;color: #800080;font-size: small">
             ‘No’
            </span>
           </span>
          </span>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            )));
            <br/>
           </span>
          </span>
          <span style="font-family: Courier New;color: #0000ff;font-size: small">
           <span style="font-family: Courier New;color: #0000ff;font-size: small">
            <span style="font-family: Courier New;color: #0000ff;font-size: small">
             run
            </span>
           </span>
          </span>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            ;
           </span>
          </span>
         </p>
         <p>
          <b>
           <span style="font-family: Courier New;color: #000080;font-size: small">
            <span style="font-family: Courier New;color: #000080;font-size: small">
             <span style="font-family: Courier New;color: #000080;font-size: small">
              proc
             </span>
            </span>
           </span>
          </b>
          <b>
           <span style="font-family: Courier New;color: #000080;font-size: small">
            <span style="font-family: Courier New;color: #000080;font-size: small">
             <span style="font-family: Courier New;color: #000080;font-size: small">
              print
             </span>
            </span>
           </span>
          </b>
          <span style="font-family: Courier New;color: #0000ff;font-size: small">
           <span style="font-family: Courier New;color: #0000ff;font-size: small">
            <span style="font-family: Courier New;color: #0000ff;font-size: small">
             data
            </span>
           </span>
          </span>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            =surviverules;
            <br/>
           </span>
          </span>
          <span style="font-family: Courier New;color: #0000ff;font-size: small">
           <span style="font-family: Courier New;color: #0000ff;font-size: small">
            <span style="font-family: Courier New;color: #0000ff;font-size: small">
             var
            </span>
           </span>
          </span>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            conf support lift rule ;
            <br/>
           </span>
          </span>
          <b>
           <span style="font-family: Courier New;color: #000080;font-size: small">
            <span style="font-family: Courier New;color: #000080;font-size: small">
             <span style="font-family: Courier New;color: #000080;font-size: small">
              run
             </span>
            </span>
           </span>
          </b>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            ;
           </span>
          </span>
         </p>
         <p>
          SAS 结果:
         </p>
         <table cellpadding="5" cellspacing="0" rules="all" summary="Procedure Print: Data Set WORK.SURVIVERULES">
          <thead>
           <tr>
            <th scope="col">
             Obs
            </th>
            <th scope="col">
             CONF
            </th>
            <th scope="col">
             SUPPORT
            </th>
            <th scope="col">
             LIFT
            </th>
            <th scope="col">
             RULE
            </th>
           </tr>
          </thead>
          <tbody>
           <tr>
            <th scope="row">
             1
            </th>
            <td>
             100.00
            </td>
            <td>
             1.09
            </td>
            <td>
             3.10
            </td>
            <td>
             2nd &amp; Child ==&gt; Yes
            </td>
           </tr>
           <tr>
            <th scope="row">
             2
            </th>
            <td>
             100.00
            </td>
            <td>
             0.59
            </td>
            <td>
             3.10
            </td>
            <td>
             2nd &amp; Child &amp; Female ==&gt; Yes
            </td>
           </tr>
           <tr>
            <th scope="row">
             3
            </th>
            <td>
             100.00
            </td>
            <td>
             0.50
            </td>
            <td>
             3.10
            </td>
            <td>
             2nd &amp; Child &amp; Male ==&gt; Yes
            </td>
           </tr>
           <tr>
            <th scope="row">
             4
            </th>
            <td>
             97.24
            </td>
            <td>
             6.41
            </td>
            <td>
             3.01
            </td>
            <td>
             1st &amp; Female ==&gt; Yes
            </td>
           </tr>
           <tr>
            <th scope="row">
             5
            </th>
            <td>
             97.22
            </td>
            <td>
             6.36
            </td>
            <td>
             3.01
            </td>
            <td>
             1st &amp; Adult &amp; Female ==&gt; Yes
            </td>
           </tr>
           <tr>
            <th scope="row">
             6
            </th>
            <td>
             91.67
            </td>
            <td>
             7.00
            </td>
            <td>
             1.35
            </td>
            <td>
             2nd &amp; Adult &amp; Male ==&gt; No
            </td>
           </tr>
           <tr>
            <th scope="row">
             7
            </th>
            <td>
             87.74
            </td>
            <td>
             4.23
            </td>
            <td>
             2.72
            </td>
            <td>
             2nd &amp; Female ==&gt; Yes
            </td>
           </tr>
           <tr>
            <th scope="row">
             8
            </th>
            <td>
             86.96
            </td>
            <td>
             0.91
            </td>
            <td>
             2.69
            </td>
            <td>
             Crew &amp; Female ==&gt; Yes
            </td>
           </tr>
           <tr>
            <th scope="row">
             9
            </th>
            <td>
             86.96
            </td>
            <td>
             0.91
            </td>
            <td>
             2.69
            </td>
            <td>
             Adult &amp; Crew &amp; Female ==&gt; Yes
            </td>
           </tr>
           <tr>
            <th scope="row">
             10
            </th>
            <td>
             86.03
            </td>
            <td>
             7.00
            </td>
            <td>
             1.27
            </td>
            <td>
             2nd &amp; Male ==&gt; No
            </td>
           </tr>
           <tr>
            <th scope="row">
             11
            </th>
            <td>
             86.02
            </td>
            <td>
             3.63
            </td>
            <td>
             2.66
            </td>
            <td>
             2nd &amp; Adult &amp; Female ==&gt; Yes
            </td>
           </tr>
           <tr>
            <th scope="row">
             12
            </th>
            <td>
             83.77
            </td>
            <td>
             17.58
            </td>
            <td>
             1.24
            </td>
            <td>
             3rd &amp; Adult &amp; Male ==&gt; No
            </td>
           </tr>
           <tr>
            <th scope="row">
             13
            </th>
            <td>
             82.75
            </td>
            <td>
             19.17
            </td>
            <td>
             1.22
            </td>
            <td>
             3rd &amp; Male ==&gt; No
            </td>
           </tr>
          </tbody>
         </table>
         <p>
          有关SAS/EM关联分析的公开资料很少，产品的在线帮助文档大概从4.3以后的版本就设置了访问权限，只有SAS/EM的用户才能阅读，新版本的功能和界面跟4.3版本有很大差别。这里只能给大家一些4.3的帮助文档，主要是上面代码中用到的几个过程步：
          <a href="http://support.sas.com/documentation/onlinedoc/miner/em43/dmdb.pdf">
           http://support.sas.com/documentation/onlinedoc/miner/em43/dmdb.pdf
          </a>
          <br/>
          <a href="http://support.sas.com/documentation/onlinedoc/miner/em43/assoc.pdf">
           http://support.sas.com/documentation/onlinedoc/miner/em43/assoc.pdf
          </a>
          <br/>
          <a href="http://support.sas.com/documentation/onlinedoc/miner/em43/sequence.pdf">
           http://support.sas.com/documentation/onlinedoc/miner/em43/sequence.pdf
          </a>
          <br/>
          <a href="http://support.sas.com/documentation/onlinedoc/miner/em43/rulegen.pdf">
           http://support.sas.com/documentation/onlinedoc/miner/em43/rulegen.pdf
          </a>
         </p>
         <p>
          mbscore(购物篮数据的预测，是EM 6.1/SAS 9.2 时新引入的过程步，支持层次关联&lt;Hierarchical Association&gt;)
         </p>
         <p>
          五、结果比较
         </p>
         <p>
          从上面的结果看，R生成了12条规则，而SAS生成了13条规则，对比每条规则后，发现SAS的第3条规则在R中没有。
         </p>
         <table cellpadding="5" cellspacing="0" rules="all" summary="Procedure Print: Data Set WORK.SURVIVERULES">
          <tbody>
           <tr>
            <th scope="row">
             3
            </th>
            <td>
             100.00
            </td>
            <td>
             0.50
            </td>
            <td>
             3.10
            </td>
            <td>
             2nd &amp; Child &amp; Male ==&gt; Yes
            </td>
           </tr>
          </tbody>
         </table>
         <p>
          我猜测原因是两个软件对最小支持度的处理不太一样，SAS可能是对最小支持度百分比乘以总记录条数后取整了。此处，泰坦尼克数据总共有2201条记录，最小支持度百分比为 0.5%，两者相乘积为11.005，而 2nd &amp; Child &amp; Male ==&gt; Yes 这条规则总共出现过11次，如果严格按照实数大小比较，不应该出现在最后的结果中，但是如果按照整数部分比较，则结果正确。打算将SAS模型切换到R或者将R模型切换到SAS的同学要注意这个差异，结果有时不完全一样！
         </p>
         <p>
          <span style="font-family: Courier New;color: #000080;font-size: small">
           <span style="font-family: Courier New;color: #000080;font-size: small">
            <span style="font-family: Courier New;color: #000080;font-size: small">
             <span style="font-family: Courier New;color: #000080;font-size: small">
              <span style="font-family: Courier New;color: #000080;font-size: small">
               <span style="font-family: Courier New;color: #000080;font-size: small">
                <strong>
                 data
                </strong>
               </span>
              </span>
             </span>
             <span style="font-family: Courier New;font-size: small">
              <span style="font-family: Courier New;font-size: small">
               <span style="color: #000000">
                min_support;
                <br/>
               </span>
              </span>
             </span>
            </span>
           </span>
          </span>
          <span style="font-family: Courier New;color: #0000ff;font-size: small">
           <span style="font-family: Courier New;color: #0000ff;font-size: small">
            <span style="font-family: Courier New;color: #0000ff;font-size: small">
             <strong>
              set
             </strong>
            </span>
           </span>
          </span>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            <strong>
             frequentItems;
             <br/>
            </strong>
           </span>
          </span>
          <strong>
           <span style="font-family: Courier New;color: #0000ff;font-size: small">
            <span style="font-family: Courier New;color: #0000ff;font-size: small">
             <span style="font-family: Courier New;color: #0000ff;font-size: small">
              if
             </span>
            </span>
           </span>
           <span style="font-family: Courier New;font-size: small">
            <span style="font-family: Courier New;font-size: small">
             count=int(
            </span>
           </span>
           <span style="font-family: Courier New;color: #008080;font-size: small">
            <span style="font-family: Courier New;color: #008080;font-size: small">
             <span style="font-family: Courier New;color: #008080;font-size: small">
              2201
             </span>
            </span>
           </span>
           <span style="font-family: Courier New;font-size: small">
            <span style="font-family: Courier New;font-size: small">
             *
            </span>
           </span>
           <span style="font-family: Courier New;color: #008080;font-size: small">
            <span style="font-family: Courier New;color: #008080;font-size: small">
             <span style="font-family: Courier New;color: #008080;font-size: small">
              0.005
             </span>
            </span>
           </span>
           <span style="font-family: Courier New;font-size: small">
            <span style="font-family: Courier New;font-size: small">
             );
             <br/>
            </span>
           </span>
          </strong>
          <span style="font-family: Courier New;color: #0000ff;font-size: small">
           <span style="font-family: Courier New;color: #0000ff;font-size: small">
            <span style="font-family: Courier New;color: #0000ff;font-size: small">
             <strong>
              run
             </strong>
            </span>
           </span>
          </span>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            <strong>
             <span style="color: #000000">
              ;
             </span>
            </strong>
           </span>
          </span>
         </p>
         <p>
          <span style="font-family: Courier New;color: #000080;font-size: small">
           <span style="font-family: Courier New;color: #000080;font-size: small">
            <span style="font-family: Courier New;color: #000080;font-size: small">
             <strong>
              proc
             </strong>
            </span>
           </span>
          </span>
          <span style="font-family: Courier New;color: #000080;font-size: small">
           <span style="font-family: Courier New;color: #000080;font-size: small">
            <span style="font-family: Courier New;color: #000080;font-size: small">
             <strong>
              print
             </strong>
            </span>
           </span>
          </span>
          <span style="font-family: Courier New;color: #0000ff;font-size: small">
           <span style="font-family: Courier New;color: #0000ff;font-size: small">
            <span style="font-family: Courier New;color: #0000ff;font-size: small">
             data
            </span>
           </span>
          </span>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            <span style="color: #000000">
             =min_support;
             <br/>
            </span>
           </span>
          </span>
          <span style="font-family: Courier New;color: #000080;font-size: small">
           <span style="font-family: Courier New;color: #000080;font-size: small">
            <span style="font-family: Courier New;color: #000080;font-size: small">
             <strong>
              run
             </strong>
            </span>
           </span>
          </span>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;color: #000000;font-size: small">
            ;
           </span>
          </span>
          <span style="font-family: Courier New;color: #000080;font-size: small">
           <span style="font-family: Courier New;color: #000080;font-size: small">
            <span style="font-family: Courier New;color: #000080;font-size: small">
             <strong>
              quit
             </strong>
            </span>
           </span>
          </span>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
            <span style="color: #000000">
             ;
            </span>
           </span>
          </span>
          <span style="font-family: Courier New;font-size: small">
           <span style="font-family: Courier New;font-size: small">
           </span>
          </span>
         </p>
         <table cellpadding="5" cellspacing="0" rules="all" summary="Procedure Print: Data Set WORK.MIN_SUPPORT">
          <thead>
           <tr>
            <th scope="col">
             Obs
            </th>
            <th scope="col">
             SET_SIZE
            </th>
            <th scope="col">
             COUNT
            </th>
            <th scope="col">
             ITEM1
            </th>
            <th scope="col">
             ITEM2
            </th>
            <th scope="col">
             ITEM3
            </th>
            <th scope="col">
             ITEM4
            </th>
            <th scope="col">
             ITEM5
            </th>
            <th scope="col">
             ITEM6
            </th>
           </tr>
          </thead>
          <tbody>
           <tr>
            <th scope="row">
             1
            </th>
            <td>
             3
            </td>
            <td>
             11
            </td>
            <td>
             2nd
            </td>
            <td>
             Child
            </td>
            <td>
             Male
            </td>
            <td>
            </td>
            <td>
            </td>
            <td>
            </td>
           </tr>
           <tr>
            <th scope="row">
             2
            </th>
            <td>
             4
            </td>
            <td>
             11
            </td>
            <td>
             2nd
            </td>
            <td>
             Child
            </td>
            <td>
             Male
            </td>
            <td>
             Yes
            </td>
            <td>
            </td>
            <td>
            </td>
           </tr>
          </tbody>
         </table>
         <p>
          相比SAS，R关联分析中比较吸引人的功能就是从规则集中去除冗余的规则，这一功能SAS里面好像没有（我没找到）。SAS用户如果想要使用R的这个功能，我找到的唯一办法就是将SAS的关联规则导出成PMML文件，然后再将PMML文件导入R生成对应的Rule对象，但是这个方法因为我的环境有点问题，所以我自己没试。
         </p>
         <p>
          有兴趣的同学，可以看看下面的资料：
          <br/>
          1）
          <a href="http://r-forge.r-project.org/forum/forum.php?set=custom&amp;forum_id=84&amp;style=nested&amp;max_rows=50&amp;submit=Change+View" target="_blank">
           如何将PMML文件导入R生成Rule对象
          </a>
          ？
          <br/>
          2）
          <a href="http://cos.name/groups/Using-PMML-SAS-Enterprise-Miner-2328634.S.199575798" target="_blank">
           如何在SAS EMM 中使用PMML？
          </a>
         </p>
         <p>
          附：PMML技术的未来
         </p>
         <p>
          对于模型的部署和使用，尤其是跨软件、平台的使用场景下或者对于大数据的分析，PMML是一个可行的解决方案，有一些厂商已经在自己的产品中通过PMML这种方式来实现对大数据的分析预测。
         </p>
         <p>
          Zementis：
          <br/>
          <a href="http://www.revolutionanalytics.com/news-events/free-webinars/2011/deploying-predictive-analytics/Deploying-Predictive-Analytics-with-PMML.pdf" target="_blank">
           Deploying Predictive Analytics with PMML, R evolution R, and ADAPA
          </a>
          <br/>
          <a href="http://www.sybase.com/files/White_Papers/Sybase_AcceleratingTimeToValue_wp.pdf">
           <span style="color: #1e5faa">
            PMML: Accelerating the Time to Value for Predictive Analytics in the Big Data Era
           </span>
          </a>
         </p>
         <p>
          IBM：
          <a href="ftp://ftp.software.ibm.com/software/analytics/spss/documentation/modeler/14.2/en/DatabaseMiningGuide.pdf" target="_blank">
           Database Mining Guide
          </a>
         </p>
         <div class="wumii-hook">
          <br/>
          <br/>
         </div>
        </div>
        <!-- .entry-content -->
        <footer class="entry-meta">
        </footer>
        <!-- .entry-meta -->
       </article>
       <!-- #post -->
       <nav class="navigation post-navigation" role="navigation">
        <h1 class="screen-reader-text">
         文章导航
        </h1>
        <div class="nav-links">
         <a href="http://cos.name/2013/02/dangers-everywhere-in-random-experiment/" rel="prev">
          <span class="meta-nav">
           ←
          </span>
          COS每周精选:随机试验处处坑
         </a>
         <a href="http://cos.name/2013/02/webgl-instead-of-html5/" rel="next">
          COS每周精选:还在研究HTML5么，看看WebGL如何!
          <span class="meta-nav">
           →
          </span>
         </a>
        </div>
        <!-- .nav-links -->
       </nav>
       <!-- .navigation -->
       <div class="comments-area" id="comments">
        <h2 class="comments-title">
         《
         <span>
          关联规则：R与SAS的比较
         </span>
         》有14个想法
        </h2>
        <ol class="comment-list">
         <li class="comment even thread-even depth-1 parent" id="comment-3717">
          <article class="comment-body" id="div-comment-3717">
           <footer class="comment-meta">
            <div class="comment-author vcard">
             <img src="http://sdn.geekzu.org/avatar/6ca0529d22d1bf25a1e5cee3af3456f9?s=74&amp;d=monsterid&amp;r=g"/>
             <b class="fn">
              <a class="url" href="http://bjt.nameq" rel="external nofollow">
               刘思喆
              </a>
             </b>
             <span class="says">
              说道：
             </span>
            </div>
            <!-- .comment-author -->
            <div class="comment-metadata">
             <a href="http://cos.name/2013/02/association-rules-with-r-and-sas/#comment-3717">
              <time datetime="2013-02-18T10:11:45+00:00">
               2013/02/18 10:11
              </time>
             </a>
            </div>
            <!-- .comment-metadata -->
           </footer>
           <!-- .comment-meta -->
           <div class="comment-content">
            <p>
             建议更改一下名词的翻译，容易产生误解：Association Rules一般对应关联规则；关联（对应）分析让我想起了Correspondence Analysis
            </p>
           </div>
           <!-- .comment-content -->
           <div class="reply">
            <a aria-label="回复给刘思喆" class="comment-reply-link" href="http://cos.name/2013/02/association-rules-with-r-and-sas/?replytocom=3717#respond" onclick='return addComment.moveForm( "div-comment-3717", "3717", "respond", "7227" )' rel="nofollow">
             回复
            </a>
           </div>
          </article>
          <!-- .comment-body -->
          <ol class="children">
           <li class="comment byuser comment-author-emilygao bypostauthor odd alt depth-2" id="comment-3747">
            <article class="comment-body" id="div-comment-3747">
             <footer class="comment-meta">
              <div class="comment-author vcard">
               <img src="http://sdn.geekzu.org/avatar/8d0af5a05e92215513f23dd3a0ac098b?s=74&amp;d=monsterid&amp;r=g"/>
               <b class="fn">
                高 燕
               </b>
               <span class="says">
                说道：
               </span>
              </div>
              <!-- .comment-author -->
              <div class="comment-metadata">
               <a href="http://cos.name/2013/02/association-rules-with-r-and-sas/#comment-3747">
                <time datetime="2013-02-24T09:16:35+00:00">
                 2013/02/24 09:16
                </time>
               </a>
              </div>
              <!-- .comment-metadata -->
             </footer>
             <!-- .comment-meta -->
             <div class="comment-content">
              <p>
               谢谢！标题已改。
              </p>
             </div>
             <!-- .comment-content -->
             <div class="reply">
              <a aria-label="回复给高 燕" class="comment-reply-link" href="http://cos.name/2013/02/association-rules-with-r-and-sas/?replytocom=3747#respond" onclick='return addComment.moveForm( "div-comment-3747", "3747", "respond", "7227" )' rel="nofollow">
               回复
              </a>
             </div>
            </article>
            <!-- .comment-body -->
           </li>
           <!-- #comment-## -->
          </ol>
          <!-- .children -->
         </li>
         <!-- #comment-## -->
         <li class="comment even thread-odd thread-alt depth-1 parent" id="comment-3774">
          <article class="comment-body" id="div-comment-3774">
           <footer class="comment-meta">
            <div class="comment-author vcard">
             <img src="http://sdn.geekzu.org/avatar/0c0f849410dda1f6ac69c9316215af89?s=74&amp;d=monsterid&amp;r=g"/>
             <b class="fn">
              <a class="url" href="http://weibo.com/u/1997763905" rel="external nofollow">
               代冕
              </a>
             </b>
             <span class="says">
              说道：
             </span>
            </div>
            <!-- .comment-author -->
            <div class="comment-metadata">
             <a href="http://cos.name/2013/02/association-rules-with-r-and-sas/#comment-3774">
              <time datetime="2013-03-04T20:59:23+00:00">
               2013/03/04 20:59
              </time>
             </a>
            </div>
            <!-- .comment-metadata -->
           </footer>
           <!-- .comment-meta -->
           <div class="comment-content">
            <p>
             错误于load(con) : 找不到对象’con’，这是怎么回事呢？
             <br/>
             第一次使用R，遇到好多问题啊！
            </p>
           </div>
           <!-- .comment-content -->
           <div class="reply">
            <a aria-label="回复给代冕" class="comment-reply-link" href="http://cos.name/2013/02/association-rules-with-r-and-sas/?replytocom=3774#respond" onclick='return addComment.moveForm( "div-comment-3774", "3774", "respond", "7227" )' rel="nofollow">
             回复
            </a>
           </div>
          </article>
          <!-- .comment-body -->
          <ol class="children">
           <li class="comment odd alt depth-2 parent" id="comment-3943">
            <article class="comment-body" id="div-comment-3943">
             <footer class="comment-meta">
              <div class="comment-author vcard">
               <img src="http://sdn.geekzu.org/avatar/2e292bc2bb266ba7b4f60ada86fb2738?s=74&amp;d=monsterid&amp;r=g"/>
               <b class="fn">
                causu
               </b>
               <span class="says">
                说道：
               </span>
              </div>
              <!-- .comment-author -->
              <div class="comment-metadata">
               <a href="http://cos.name/2013/02/association-rules-with-r-and-sas/#comment-3943">
                <time datetime="2013-04-09T08:06:09+00:00">
                 2013/04/09 08:06
                </time>
               </a>
              </div>
              <!-- .comment-metadata -->
             </footer>
             <!-- .comment-meta -->
             <div class="comment-content">
              <p>
               Copy这个试试，con &lt;- url("
               <a href="http://www.rdatamining.com/data/titanic.raw.rdata&amp;quot" rel="nofollow">
                http://www.rdatamining.com/data/titanic.raw.rdata&amp;quot
               </a>
               ;)，楼主博文中的con中的网址的引号复制下来是R不能识别的。所以你再重新修改下引号就可以了。
              </p>
             </div>
             <!-- .comment-content -->
             <div class="reply">
              <a aria-label="回复给causu" class="comment-reply-link" href="http://cos.name/2013/02/association-rules-with-r-and-sas/?replytocom=3943#respond" onclick='return addComment.moveForm( "div-comment-3943", "3943", "respond", "7227" )' rel="nofollow">
               回复
              </a>
             </div>
            </article>
            <!-- .comment-body -->
            <ol class="children">
             <li class="comment even depth-3" id="comment-4662">
              <article class="comment-body" id="div-comment-4662">
               <footer class="comment-meta">
                <div class="comment-author vcard">
                 <img src="http://sdn.geekzu.org/avatar/57d9fb9129f6977c7ac2ac79f6261f4b?s=74&amp;d=monsterid&amp;r=g"/>
                 <b class="fn">
                  hy
                 </b>
                 <span class="says">
                  说道：
                 </span>
                </div>
                <!-- .comment-author -->
                <div class="comment-metadata">
                 <a href="http://cos.name/2013/02/association-rules-with-r-and-sas/#comment-4662">
                  <time datetime="2013-08-18T23:41:03+00:00">
                   2013/08/18 23:41
                  </time>
                 </a>
                </div>
                <!-- .comment-metadata -->
               </footer>
               <!-- .comment-meta -->
               <div class="comment-content">
                <p>
                 什么意思？还是不行。是改成这样吗？con &lt;- url("
                 <a href="http://www.rdatamining.com/data/titanic.raw.rdata&amp;quot" rel="nofollow">
                  http://www.rdatamining.com/data/titanic.raw.rdata&amp;quot
                 </a>
                 😉
                </p>
               </div>
               <!-- .comment-content -->
              </article>
              <!-- .comment-body -->
             </li>
             <!-- #comment-## -->
            </ol>
            <!-- .children -->
           </li>
           <!-- #comment-## -->
          </ol>
          <!-- .children -->
         </li>
         <!-- #comment-## -->
         <li class="comment odd alt thread-even depth-1" id="comment-3776">
          <article class="comment-body" id="div-comment-3776">
           <footer class="comment-meta">
            <div class="comment-author vcard">
             <img src="http://sdn.geekzu.org/avatar/571dec833e4d53bfc89095658d76c927?s=74&amp;d=monsterid&amp;r=g"/>
             <b class="fn">
              ada
             </b>
             <span class="says">
              说道：
             </span>
            </div>
            <!-- .comment-author -->
            <div class="comment-metadata">
             <a href="http://cos.name/2013/02/association-rules-with-r-and-sas/#comment-3776">
              <time datetime="2013-03-05T11:46:56+00:00">
               2013/03/05 11:46
              </time>
             </a>
            </div>
            <!-- .comment-metadata -->
           </footer>
           <!-- .comment-meta -->
           <div class="comment-content">
            <p>
             利用R去除冗余规则后的结果是不是还有冗余？比如规则5不是包含在规则6中、规则7不是包含规则8中吗？
            </p>
           </div>
           <!-- .comment-content -->
           <div class="reply">
            <a aria-label="回复给ada" class="comment-reply-link" href="http://cos.name/2013/02/association-rules-with-r-and-sas/?replytocom=3776#respond" onclick='return addComment.moveForm( "div-comment-3776", "3776", "respond", "7227" )' rel="nofollow">
             回复
            </a>
           </div>
          </article>
          <!-- .comment-body -->
         </li>
         <!-- #comment-## -->
         <li class="comment even thread-odd thread-alt depth-1 parent" id="comment-4085">
          <article class="comment-body" id="div-comment-4085">
           <footer class="comment-meta">
            <div class="comment-author vcard">
             <img src="http://sdn.geekzu.org/avatar/54631d0f7caa8edd10dc458c55f6c695?s=74&amp;d=monsterid&amp;r=g"/>
             <b class="fn">
              斯坦尼斯
             </b>
             <span class="says">
              说道：
             </span>
            </div>
            <!-- .comment-author -->
            <div class="comment-metadata">
             <a href="http://cos.name/2013/02/association-rules-with-r-and-sas/#comment-4085">
              <time datetime="2013-04-23T14:01:16+00:00">
               2013/04/23 14:01
              </time>
             </a>
            </div>
            <!-- .comment-metadata -->
           </footer>
           <!-- .comment-meta -->
           <div class="comment-content">
            <p>
             提示：
            </p>
            <p>
             # rules with rhs containing “Survived” only
             <br/>
             &gt; rules  rules.sorted  inspect(rules.sorted)
             <br/>
             错误于inspect(rules.sorted) :
             <br/>
             在为’inspect’函数选择方法时评估’x’参数出了错: 错误: 找不到对象’rules.sorted’
            </p>
            <p>
             新手，这个是怎么回事啊？
            </p>
           </div>
           <!-- .comment-content -->
           <div class="reply">
            <a aria-label="回复给斯坦尼斯" class="comment-reply-link" href="http://cos.name/2013/02/association-rules-with-r-and-sas/?replytocom=4085#respond" onclick='return addComment.moveForm( "div-comment-4085", "4085", "respond", "7227" )' rel="nofollow">
             回复
            </a>
           </div>
          </article>
          <!-- .comment-body -->
          <ol class="children">
           <li class="comment odd alt depth-2" id="comment-4607">
            <article class="comment-body" id="div-comment-4607">
             <footer class="comment-meta">
              <div class="comment-author vcard">
               <img src="http://sdn.geekzu.org/avatar/f30524d7df669026bc6669d31a4633d6?s=74&amp;d=monsterid&amp;r=g"/>
               <b class="fn">
                唐小志
               </b>
               <span class="says">
                说道：
               </span>
              </div>
              <!-- .comment-author -->
              <div class="comment-metadata">
               <a href="http://cos.name/2013/02/association-rules-with-r-and-sas/#comment-4607">
                <time datetime="2013-08-06T16:13:25+00:00">
                 2013/08/06 16:13
                </time>
               </a>
              </div>
              <!-- .comment-metadata -->
             </footer>
             <!-- .comment-meta -->
             <div class="comment-content">
              <p>
               你这个本来是两行代码写成了一行
              </p>
             </div>
             <!-- .comment-content -->
             <div class="reply">
              <a aria-label="回复给唐小志" class="comment-reply-link" href="http://cos.name/2013/02/association-rules-with-r-and-sas/?replytocom=4607#respond" onclick='return addComment.moveForm( "div-comment-4607", "4607", "respond", "7227" )' rel="nofollow">
               回复
              </a>
             </div>
            </article>
            <!-- .comment-body -->
           </li>
           <!-- #comment-## -->
          </ol>
          <!-- .children -->
         </li>
         <!-- #comment-## -->
         <li class="comment even thread-even depth-1" id="comment-4361">
          <article class="comment-body" id="div-comment-4361">
           <footer class="comment-meta">
            <div class="comment-author vcard">
             <img src="http://sdn.geekzu.org/avatar/9d6f4f0a10291d9de540d66649628c23?s=74&amp;d=monsterid&amp;r=g"/>
             <b class="fn">
              F0532
             </b>
             <span class="says">
              说道：
             </span>
            </div>
            <!-- .comment-author -->
            <div class="comment-metadata">
             <a href="http://cos.name/2013/02/association-rules-with-r-and-sas/#comment-4361">
              <time datetime="2013-06-08T22:58:47+00:00">
               2013/06/08 22:58
              </time>
             </a>
            </div>
            <!-- .comment-metadata -->
           </footer>
           <!-- .comment-meta -->
           <div class="comment-content">
            <p>
             感谢楼主分享
            </p>
           </div>
           <!-- .comment-content -->
           <div class="reply">
            <a aria-label="回复给F0532" class="comment-reply-link" href="http://cos.name/2013/02/association-rules-with-r-and-sas/?replytocom=4361#respond" onclick='return addComment.moveForm( "div-comment-4361", "4361", "respond", "7227" )' rel="nofollow">
             回复
            </a>
           </div>
          </article>
          <!-- .comment-body -->
         </li>
         <!-- #comment-## -->
         <li class="comment odd alt thread-odd thread-alt depth-1" id="comment-4606">
          <article class="comment-body" id="div-comment-4606">
           <footer class="comment-meta">
            <div class="comment-author vcard">
             <img src="http://sdn.geekzu.org/avatar/f30524d7df669026bc6669d31a4633d6?s=74&amp;d=monsterid&amp;r=g"/>
             <b class="fn">
              唐小志
             </b>
             <span class="says">
              说道：
             </span>
            </div>
            <!-- .comment-author -->
            <div class="comment-metadata">
             <a href="http://cos.name/2013/02/association-rules-with-r-and-sas/#comment-4606">
              <time datetime="2013-08-06T16:10:55+00:00">
               2013/08/06 16:10
              </time>
             </a>
            </div>
            <!-- .comment-metadata -->
           </footer>
           <!-- .comment-meta -->
           <div class="comment-content">
            <p>
             为什么我生成出来的结果和作者用R得到的结果不一样呢？
            </p>
           </div>
           <!-- .comment-content -->
           <div class="reply">
            <a aria-label="回复给唐小志" class="comment-reply-link" href="http://cos.name/2013/02/association-rules-with-r-and-sas/?replytocom=4606#respond" onclick='return addComment.moveForm( "div-comment-4606", "4606", "respond", "7227" )' rel="nofollow">
             回复
            </a>
           </div>
          </article>
          <!-- .comment-body -->
         </li>
         <!-- #comment-## -->
         <li class="comment even thread-even depth-1" id="comment-5049">
          <article class="comment-body" id="div-comment-5049">
           <footer class="comment-meta">
            <div class="comment-author vcard">
             <img src="http://sdn.geekzu.org/avatar/?s=74&amp;d=monsterid&amp;r=g"/>
             <b class="fn">
              <a class="url" href="http://weibo.com/1342199273" rel="external nofollow">
               paradoxbirdy
              </a>
             </b>
             <span class="says">
              说道：
             </span>
            </div>
            <!-- .comment-author -->
            <div class="comment-metadata">
             <a href="http://cos.name/2013/02/association-rules-with-r-and-sas/#comment-5049">
              <time datetime="2013-11-08T14:22:06+00:00">
               2013/11/08 14:22
              </time>
             </a>
            </div>
            <!-- .comment-metadata -->
           </footer>
           <!-- .comment-meta -->
           <div class="comment-content">
            <p>
             哟吼～真不错的比较文章。
            </p>
           </div>
           <!-- .comment-content -->
           <div class="reply">
            <a aria-label="回复给paradoxbirdy" class="comment-reply-link" href="http://cos.name/2013/02/association-rules-with-r-and-sas/?replytocom=5049#respond" onclick='return addComment.moveForm( "div-comment-5049", "5049", "respond", "7227" )' rel="nofollow">
             回复
            </a>
           </div>
          </article>
          <!-- .comment-body -->
         </li>
         <!-- #comment-## -->
         <li class="comment odd alt thread-odd thread-alt depth-1" id="comment-5072">
          <article class="comment-body" id="div-comment-5072">
           <footer class="comment-meta">
            <div class="comment-author vcard">
             <img src="http://sdn.geekzu.org/avatar/6ca0529d22d1bf25a1e5cee3af3456f9?s=74&amp;d=monsterid&amp;r=g"/>
             <b class="fn">
              <a class="url" href="http://weibo.com/sunbjt" rel="external nofollow">
               刘思喆
              </a>
             </b>
             <span class="says">
              说道：
             </span>
            </div>
            <!-- .comment-author -->
            <div class="comment-metadata">
             <a href="http://cos.name/2013/02/association-rules-with-r-and-sas/#comment-5072">
              <time datetime="2013-11-13T15:53:26+00:00">
               2013/11/13 15:53
              </time>
             </a>
            </div>
            <!-- .comment-metadata -->
           </footer>
           <!-- .comment-meta -->
           <div class="comment-content">
            <p>
             apriori算法的作者也有FP_growth的开源，但没有人封装到R。不过用起来还是很容易的。如果只是求解频繁二项集，R两行代码也就搞定了，还可已并行噢～～
            </p>
           </div>
           <!-- .comment-content -->
           <div class="reply">
            <a aria-label="回复给刘思喆" class="comment-reply-link" href="http://cos.name/2013/02/association-rules-with-r-and-sas/?replytocom=5072#respond" onclick='return addComment.moveForm( "div-comment-5072", "5072", "respond", "7227" )' rel="nofollow">
             回复
            </a>
           </div>
          </article>
          <!-- .comment-body -->
         </li>
         <!-- #comment-## -->
         <li class="comment even thread-even depth-1" id="comment-5080">
          <article class="comment-body" id="div-comment-5080">
           <footer class="comment-meta">
            <div class="comment-author vcard">
             <img src="http://sdn.geekzu.org/avatar/?s=74&amp;d=monsterid&amp;r=g"/>
             <b class="fn">
              <a class="url" href="http://weibo.com/1898839083" rel="external nofollow">
               牙签好粗君
              </a>
             </b>
             <span class="says">
              说道：
             </span>
            </div>
            <!-- .comment-author -->
            <div class="comment-metadata">
             <a href="http://cos.name/2013/02/association-rules-with-r-and-sas/#comment-5080">
              <time datetime="2013-11-14T17:15:58+00:00">
               2013/11/14 17:15
              </time>
             </a>
            </div>
            <!-- .comment-metadata -->
           </footer>
           <!-- .comment-meta -->
           <div class="comment-content">
            <p>
             我想问下怎么把SAS关联规则结果提取到R中？
            </p>
           </div>
           <!-- .comment-content -->
           <div class="reply">
            <a aria-label="回复给牙签好粗君" class="comment-reply-link" href="http://cos.name/2013/02/association-rules-with-r-and-sas/?replytocom=5080#respond" onclick='return addComment.moveForm( "div-comment-5080", "5080", "respond", "7227" )' rel="nofollow">
             回复
            </a>
           </div>
          </article>
          <!-- .comment-body -->
         </li>
         <!-- #comment-## -->
         <li class="comment odd alt thread-odd thread-alt depth-1" id="comment-5905">
          <article class="comment-body" id="div-comment-5905">
           <footer class="comment-meta">
            <div class="comment-author vcard">
             <img src="http://sdn.geekzu.org/avatar/?s=74&amp;d=monsterid&amp;r=g"/>
             <b class="fn">
              <a class="url" href="http://weibo.com/kakaymi" rel="external nofollow">
               kakaymi
              </a>
             </b>
             <span class="says">
              说道：
             </span>
            </div>
            <!-- .comment-author -->
            <div class="comment-metadata">
             <a href="http://cos.name/2013/02/association-rules-with-r-and-sas/#comment-5905">
              <time datetime="2014-06-16T15:41:29+00:00">
               2014/06/16 15:41
              </time>
             </a>
            </div>
            <!-- .comment-metadata -->
           </footer>
           <!-- .comment-meta -->
           <div class="comment-content">
            <p>
             写的很清楚，照着练习
             <img src="http://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/c9/geili_org.gif"/>
            </p>
           </div>
           <!-- .comment-content -->
           <div class="reply">
            <a aria-label="回复给kakaymi" class="comment-reply-link" href="http://cos.name/2013/02/association-rules-with-r-and-sas/?replytocom=5905#respond" onclick='return addComment.moveForm( "div-comment-5905", "5905", "respond", "7227" )' rel="nofollow">
             回复
            </a>
           </div>
          </article>
          <!-- .comment-body -->
         </li>
         <!-- #comment-## -->
        </ol>
        <!-- .comment-list -->
        <div class="comment-respond" id="respond">
         <h3 class="comment-reply-title" id="reply-title">
          发表评论
          <small>
           <a href="http://cos.name/2013/02/association-rules-with-r-and-sas/#respond" id="cancel-comment-reply-link" rel="nofollow" style="display:none;">
            取消回复
           </a>
          </small>
         </h3>
         <form action="http://cos.name/wp-comments-post.php" class="comment-form" id="commentform" method="post" novalidate="">
          <p class="comment-notes">
           <span id="email-notes">
            电子邮件地址不会被公开。
           </span>
           必填项已用
           <span class="required">
            *
           </span>
           标注
          </p>
          <p class="comment-form-comment">
           <label for="comment">
            评论
           </label>
           <textarea aria-required="true" cols="45" id="comment" maxlength="65525" name="comment" required="required" rows="8">
           </textarea>
          </p>
          <p class="comment-form-author">
           <label for="author">
            姓名
            <span class="required">
             *
            </span>
           </label>
          </p>
          <p class="comment-form-email">
           <label for="email">
            电子邮件
            <span class="required">
             *
            </span>
           </label>
          </p>
          <p class="comment-form-url">
           <label for="url">
            站点
           </label>
          </p>
          <p class="form-submit">
          </p>
          <p style="display: none;">
          </p>
          <p style="display: none;">
          </p>
         </form>
        </div>
        <!-- #respond -->
       </div>
       <!-- #comments -->
      </div>
      <!-- #content -->
     </div>
     <!-- #primary -->
     <div class="sidebar-container" id="tertiary" role="complementary">
      <div class="sidebar-inner">
       <div class="widget-area">
        <aside class="widget widget_text" id="text-3">
         <h3 class="widget-title">
          关注统计之都
         </h3>
         <div class="textwidget">
          <ul>
           <li>
            新浪微博
            <a href="http://weibo.com/cosname">
             @统计之都
            </a>
           </li>
           <li>
            人人网
            <a href="http://renren.com/cosname">
             @统计之都
            </a>
           </li>
           <li>
            Twitter
            <a href="http://twitter.com/cos_name">
             @cos_name
            </a>
           </li>
          </ul>
         </div>
        </aside>
        <aside class="widget widget_text" id="text-6">
         <h3 class="widget-title">
          微信公众平台
         </h3>
         <div class="textwidget">
          <img src="http://cos.name/wp-content/uploads/2013/04/qrcode-8cm.jpg"/>
          <p style="font-size:12px;margin-left:15px">
           微信号 CapStat
          </p>
          <p>
           我们将第一时间向您推送主站和论坛的精彩内容，以及统计之都的线下活动、竞赛、培训和会议信息。
          </p>
         </div>
        </aside>
        <aside class="widget widget_text" id="text-8">
         <h3 class="widget-title">
          站内导航
         </h3>
         <div class="textwidget">
          <ul>
           <li class="page_item">
            <a href="http://cos.name/cn/">
             中文论坛
            </a>
           </li>
           <li class="page_item">
            <a href="http://cos.name/videos/">
             视频
            </a>
           </li>
           <li class="page_item">
            <a href="http://cos.name/salon/">
             统计沙龙
            </a>
           </li>
           <li class="page_item">
            <a href="http://cos.name/books/">
             图书出版
            </a>
           </li>
           <li class="page_item">
            <a href="http://cos.name/training/">
             教育培训
            </a>
           </li>
           <li class="page_item">
            <a href="http://cos.name/about/">
             关于我们
            </a>
           </li>
           <li class="page_item">
            <a href="http://cos.name/donate/">
             捐赠
            </a>
           </li>
           <li class="page_item">
            <a href="http://cos.name/chinar/">
             R语言会议
            </a>
           </li>
          </ul>
         </div>
        </aside>
        <aside class="widget widget_links" id="linkcat-2">
         <h3 class="widget-title">
          友情链接
         </h3>
         <ul class="xoxo blogroll">
          <li>
           <a href="http://stat.ruc.edu.cn" target="_blank" title="中国人民大学统计学院网站">
            中国人民大学统计学院
           </a>
          </li>
          <li>
           <a href="http://rucdmc.net">
            中国人民大学数据挖掘中心
           </a>
          </li>
          <li>
           <a href="http://birc.gsm.pku.edu.cn/" target="_blank">
            北京大学商务智能研究中心
           </a>
          </li>
          <li>
           <a href="http://sam.cufe.edu.cn/" target="_blank" title="中央财经大学统计与数学学院网站">
            中央财经大学统计与数学学院
           </a>
          </li>
          <li>
           <a href="http://tjx.cueb.edu.cn/" target="_blank" title="首都经济贸易大学统计学院网站">
            首经贸统计学院
           </a>
          </li>
          <li>
           <a href="http://www.shookr.com/">
            数客网大数据社区
           </a>
          </li>
          <li>
           <a href="http://www.xueqing.tv/" target="_blank" title="数据科学在线学习平台">
            雪晴数据网
           </a>
          </li>
          <li>
           <a href="http://iera.name/" target="_blank" title="IERA是一个旨在普及、传播和增进工业工程知识的非营利性网站">
            IERA（直通IE）
           </a>
          </li>
         </ul>
        </aside>
        <aside class="widget widget_categories" id="categories-2">
         <h3 class="widget-title">
          全部分类
         </h3>
         <label class="screen-reader-text" for="cat">
          全部分类
         </label>
         <select class="postform" id="cat" name="cat">
          <option value="-1">
           选择分类目录
          </option>
          <option class="level-0" value="925">
           cos访谈  (4)
          </option>
          <option class="level-0" value="659">
           图书出版  (5)
          </option>
          <option class="level-0" value="379">
           数学方法  (14)
          </option>
          <option class="level-1" value="381">
           分析与代数  (1)
          </option>
          <option class="level-1" value="380">
           概率论  (9)
          </option>
          <option class="level-1" value="382">
           随机过程  (5)
          </option>
          <option class="level-0" value="210">
           数据分析  (81)
          </option>
          <option class="level-1" value="203">
           多元统计  (3)
          </option>
          <option class="level-1" value="42">
           数据挖掘与机器学习  (42)
          </option>
          <option class="level-1" value="36">
           生物与医学统计  (17)
          </option>
          <option class="level-1" value="35">
           计量经济学  (4)
          </option>
          <option class="level-1" value="296">
           金融统计  (3)
          </option>
          <option class="level-1" value="303">
           风险精算  (7)
          </option>
          <option class="level-0" value="177">
           模型专题  (15)
          </option>
          <option class="level-1" value="38">
           回归分析  (10)
          </option>
          <option class="level-1" value="41">
           时间序列  (2)
          </option>
          <option class="level-0" value="784">
           每周精选  (24)
          </option>
          <option class="level-1" value="183">
           可视化  (9)
          </option>
          <option class="level-0" value="967">
           沙龙纪要  (3)
          </option>
          <option class="level-0" value="18">
           经典理论  (46)
          </option>
          <option class="level-1" value="37">
           抽样调查  (3)
          </option>
          <option class="level-1" value="4">
           统计推断  (26)
          </option>
          <option class="level-1" value="236">
           试验设计  (7)
          </option>
          <option class="level-1" value="39">
           非参数统计  (3)
          </option>
          <option class="level-0" value="1">
           统计之都  (279)
          </option>
          <option class="level-1" value="884">
           中国R会议  (2)
          </option>
          <option class="level-1" value="885">
           中国R语言会议  (5)
          </option>
          <option class="level-1" value="446">
           出国留学  (3)
          </option>
          <option class="level-1" value="179">
           推荐文章  (90)
          </option>
          <option class="level-1" value="3">
           新闻通知  (75)
          </option>
          <option class="level-1" value="263">
           统计刊物  (10)
          </option>
          <option class="level-1" value="174">
           网站导读  (40)
          </option>
          <option class="level-1" value="204">
           职业事业  (51)
          </option>
          <option class="level-1" value="213">
           高校课堂  (9)
          </option>
          <option class="level-0" value="178">
           统计计算  (28)
          </option>
          <option class="level-1" value="40">
           优化与模拟  (15)
          </option>
          <option class="level-1" value="43">
           贝叶斯方法  (6)
          </option>
          <option class="level-0" value="378">
           软件应用  (116)
          </option>
          <option class="level-1" value="44">
           统计图形  (36)
          </option>
          <option class="level-1" value="110">
           统计软件  (83)
          </option>
         </select>
        </aside>
        <aside class="widget widget_recent_comments" id="recent-comments-2">
         <h3 class="widget-title">
          最新评论
         </h3>
         <ul id="recentcomments">
          <li class="recentcomments">
           <span class="comment-author-link">
            fineboom
           </span>
           发表在《
           <a href="http://cos.name/2016/06/use-shiny-fleetly-set-up-visual-prototype-system/#comment-7317">
            利用shiny包快速搭建可视化原型系统
           </a>
           》
          </li>
          <li class="recentcomments">
           <span class="comment-author-link">
            胡家新
           </span>
           发表在《
           <a href="http://cos.name/2016/06/r%e8%af%ad%e5%8d%83%e5%af%bb%e7%ac%ac%e4%b8%89%e6%9c%9f%ef%bc%9a%e5%bc%a0%e6%97%a0%e5%bf%8c%e7%a9%b6%e7%ab%9f%e7%88%b1%e8%b0%81%ef%bc%9f/#comment-7316">
            R语千寻第三期：张无忌究竟爱谁？
           </a>
           》
          </li>
          <li class="recentcomments">
           <span class="comment-author-link">
            <a class="url" href="http://www.zijiacha.com/category.php?id=6" rel="external nofollow">
             南糯山普洱茶
            </a>
           </span>
           发表在《
           <a href="http://cos.name/2016/06/r%e8%af%ad%e5%8d%83%e5%af%bb%e7%ac%ac%e4%b8%89%e6%9c%9f%ef%bc%9a%e5%bc%a0%e6%97%a0%e5%bf%8c%e7%a9%b6%e7%ab%9f%e7%88%b1%e8%b0%81%ef%bc%9f/#comment-7315">
            R语千寻第三期：张无忌究竟爱谁？
           </a>
           》
          </li>
          <li class="recentcomments">
           <span class="comment-author-link">
            J
           </span>
           发表在《
           <a href="http://cos.name/2016/05/value-of-the-reputation-from-the-data/#comment-7314">
            数据告诉你：高信誉的卖家应该收高价，还是收低价？
           </a>
           》
          </li>
          <li class="recentcomments">
           <span class="comment-author-link">
            <a class="url" href="http://gg" rel="external nofollow">
             Hilda
            </a>
           </span>
           发表在《
           <a href="http://cos.name/2013/01/drawing-map-in-r-era/#comment-7311">
            R时代，你要怎样画地图？
           </a>
           》
          </li>
         </ul>
        </aside>
        <aside class="widget widget_rss" id="rss-282869971">
         <h3 class="widget-title">
          <a class="rsswidget" href="http://cos.name/cn/topics/feed/">
           <img src="http://cos.name/wp-includes/images/rss.png"/>
          </a>
          <a class="rsswidget" href="http://cos.name/cn/topics/feed/">
           中文论坛新帖
          </a>
         </h3>
         <ul>
          <li>
           <a class="rsswidget" href="http://cos.name/cn/topic/417372/">
            处理时间数据和产生时间序列的问题
           </a>
          </li>
          <li>
           <a class="rsswidget" href="http://cos.name/cn/topic/6790/">
            《统计陷阱》下载 （How to lie with statistics）
           </a>
          </li>
          <li>
           <a class="rsswidget" href="http://cos.name/cn/topic/818/">
            统计学的世界（第五版）
           </a>
          </li>
          <li>
           <a class="rsswidget" href="http://cos.name/cn/topic/16574/">
            class(x) 返回值值是AsIs,AsIs代表什么，有什么用处？
           </a>
          </li>
          <li>
           <a class="rsswidget" href="http://cos.name/cn/topic/417366/">
            如何用R绘制一个分类算法的决策规则
           </a>
          </li>
         </ul>
        </aside>
        <aside class="widget widget_text" id="text-2">
         <h3 class="widget-title">
          登录/RSS
         </h3>
         <div class="textwidget">
          <ul>
           <li>
            <a href="http://cos.name/wp-admin/">
             登录
            </a>
           </li>
           <li>
            <a href="http://cos.name/feed/" title="使用 RSS 2.0 同步站点内容">
             文章
             <abbr title="Really Simple Syndication">
              RSS
             </abbr>
            </a>
           </li>
           <li>
            <a href="http://cos.name/comments/feed/" title="RSS 上的最近评论">
             评论
             <abbr title="Really Simple Syndication">
              RSS
             </abbr>
            </a>
           </li>
          </ul>
         </div>
        </aside>
       </div>
       <!-- .widget-area -->
      </div>
      <!-- .sidebar-inner -->
     </div>
     <!-- #tertiary -->
    </div>
    <!-- #main -->
    <footer class="site-footer" id="colophon" role="contentinfo">
     <div class="site-info">
      版权所有 © 2014 统计之都 | 由
      <a href="http://wordpress.org/">
       WordPress
      </a>
      构建 | 主题修改自
      <a href="http://wordpress.org/themes/twentythirteen">
       Twenty Thirteen
      </a>
     </div>
     <!-- .site-info -->
    </footer>
    <!-- #colophon -->
   </div>
   <!-- #page -->
   <p style="margin:0;padding:0;height:1px;overflow:hidden;">
    <a href="http://www.wumii.com/widget/relatedItems" style="border:0;">
     <img src="http://static.wumii.cn/images/pixel.png"/>
    </a>
   </p>
  </div>
 </body>
</html>